package elephant.webserver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import elephant.Container;
import elephant.servers.webserver.WebServer;
import elephant.service.rpc.RPCClientService;

/**
 * 
 * @author icecooly
 *
 */
public class DemoWebServer {
	//
	private static Logger logger=LoggerFactory.getLogger(DemoWebServer.class);
	//
	public static void main(String[] args) {
		
		Container container=Container.get();
		logger.debug("init logger");
		try {
			RPCClientService rpcService=new RPCClientService();
			rpcService.addRemoteServer("DataSystem","localhost",5001);
			container.registerService(rpcService);
			WebServer webServer=new WebServer();
			webServer.setPort(7001);
			webServer.addWar("/", "/tmp/SkyduWebSystem.war");
			//webServer.addResource("/", "/Users/icecooly/Desktop/SkyduWebSystem");
			container.registerServer(webServer);
			container.init();
			container.start();
		} catch (Exception e) {
			logger.error(e.getMessage(),e);
		}
	}
}
